# libvpx
# Builds from https://github.com/puppylinux-woof-CE/petbuilds
# File auto generated by ./mk_petbuild.sh. Edit as necessary.

. ../func
. ../build.conf

URL=http://storage.googleapis.com/downloads.webmproject.org/releases/webm
PKG=libvpx
VER=1.6.1
COMP=tar.bz2
DESC="the webm video codec library"
DEPS=
CAT=BuildingBlock
DESKTOP=libvpx.desktop
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
# comment these 2 below if you use a custom package() function
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not

ARCH=$(uname -m)
case $ARCH in # set in build.conf
 *64) 	LIBDIR=$LIBCONF64 
		FLAGS=$CF64;;
 arm*)	LIBDIR=$LIBCONFarm
		FLAGS="-O2" ;;
 i686) 	LIBDIR=$LIBCONF32 
		FLAGS=$CF32;;
	*) 	LIBDIR=$LIBCONF32 
		FLAGS="-O2 -march=$ARCH -mtune=$ARCH";;
esac

build() {
	cd ${PKG}-${VER}
	CFLAGS="$FLAGS" \
	CXXFLAGS="$FLAGS" \
	./configure --prefix=/usr \
				--libdir=/usr/${LIBDIR} \
				--enable-vp8 \
				--enable-vp9 \
				--enable-postproc \
				--enable-vp9-postproc \
				--enable-runtime-cpu-detect \
				--enable-shared
	[ "$?" -eq 0 ] || exit
	make $MKFLG
	[ "$?" -eq 0 ] || exit
	make DESTDIR=$CWD/${PKG}-install install
	cd -
}
	
# main
retrieve ${PKG}-${VER}.${COMP}
extract ${PKG}-${VER}.${COMP}
build
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT
